import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String put = in.nextLine(); //输入的
        String get = in.nextLine(); //输出的
        func(put,get);
    }
    public static void func(String put,String get) {
        Set<Character> set = new HashSet<>();
        for (char c : get.toUpperCase().toCharArray()) {
            set.add(c);
        }
        Set<Character> setBroken = new HashSet<>();
        for (char c : put.toUpperCase().toCharArray()) {
            if(!set.contains(c) && !setBroken.contains(c)) {
                setBroken.add(c);
                System.out.print(c);
            }
        }
    }
}